package com.zyz.M_File和IO流.IO流.缓冲流.BufferedReader和BufferedWriter;

import java.io.*;

/**
 * @author: vick
 * @Date: 2025/4/8
 * @Description:
 * @version: 1.0
 */
public class Demo2 {
    public static void main(String[] args) throws IOException {
        //创建缓冲流
        BufferedReader bufferedReader = new BufferedReader(new FileReader("hello-copy.txt"));
        //定义字符串，保存读取的一行文字
        String line;
        while ((line = bufferedReader.readLine()) != null) {
            System.out.println(line);
        }
        bufferedReader.close();

        System.out.println("=====");
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("out.txt"));
        bufferedWriter.write("你");
        bufferedWriter.newLine();
        bufferedWriter.write("好");
        bufferedWriter.close();
    }
}
